<!DOCTYPE html>
<html>
	<head>
		<title>用户管理后台</title>
		<meta charset="UTF-8" />
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
		<link rel="stylesheet" href="/helloworld/resources/admin/css/bootstrap.min.css" />
		<link rel="stylesheet" href="/helloworld/resources/admin/css/bootstrap-responsive.min.css" />
		<link rel="stylesheet" href="/helloworld/resources/admin/css/uniform.css" />
		<link rel="stylesheet" href="/helloworld/resources/admin/css/select2.css" />		
		<link rel="stylesheet" href="/helloworld/resources/admin/css/unicorn.main.css" />
		<link rel="stylesheet" href="/helloworld/resources/admin/css/unicorn.grey.css" class="skin-color" />
		<link rel="stylesheet" href="/helloworld/resources/admin/css/style.css" />
		<link rel="stylesheet" href="/helloworld/resources/admin/css/page.css" />	
	</head>
	<body>
		<div id="header">
			<h1>用户管理后台</h1>		
		</div>
		<div id="user-nav" class="navbar navbar-inverse">
            <ul class="nav">
                <li class="btn btn-inverse"></li>
            </ul>
        </div>
		<div id="sidebar">
			<ul>
				<li class="submenu active open" >
					<a href=""><i class="icon icon-leaf"></i> <span>用户管理</span></a>
					<ul>
						<li><a href="/helloworld/user_add.html" target="_self">用户添加</a></li>
						<li><a href="/helloworld/user_list.html" target="_self">用户列表</a></li>
					</ul>
				</li>
			</ul>
		</div>
		<div id="style-switcher">
			<i class="icon-arrow-left icon-white"></i>
			<span>风格:</span>
			<a href="#grey" style="background-color: #555555;border-color: #aaaaaa;"></a>
			<a href="#blue" style="background-color: #2D2F57;"></a>
			<a href="#red" style="background-color: #673232;"></a>
		</div>
		<div id="content">
			<div id="content-header">
				<h1>用户列表</h1>
			</div>
			<div id="breadcrumb">
				<a href="/helloworld/index.html" title="返回首页" class="tip-bottom"><i class="icon-home"></i> 首页</a>
				<a href="#" class="current">用户列表</a>
			</div>
			<div class="container-fluid">
				<div class="row-fluid">
					<div class="span12">
						<div class="widget-box">
							<div class="widget-title">
								<div class="left-buttons">	
									<a href="/helloworld/user_add.html" class="btn btn-success btn-mini"><i class="icon-plus icon-white"></i> 添加</a>
								</div>
							</div>
							<div class="widget-content nopadding">
								<table class="table table-bordered table-striped">
									<thead>
										<tr>
											<th>序号</th>
											<th>姓名</th>
											<th>年龄</th>
											<th>性别</th>
											<th>操作</th>
										</tr>
									</thead>
									<tbody>
									<#assign index = start>
									<#list userList as user>
										<tr>
										 	<#assign index = index+1>
											<td>${index}</td>
											<td>${user.name}</td>
											<td>${user.age}</td>
											<td>
											<#if user.sex=='1'>
												男
											<#else>
												女
											</#if>
											</td>
											<td class="taskOptions">
												<a href="/helloworld/user_update.html?id=${user.id}" class="tip-top" data-original-title="编辑"><i class="icon-pencil"></i></a>
												<a href="javascript:;" class="delBtn" id="${user.id}" class="tip-top" data-original-title="删除"><i class="icon-remove"></i></a>
											</td>
										</tr>
									</#list>
									</tbody>
								</table>						
							</div>
						</div>
					</div>
				</div>
				<div id="pagination" class="pagination"></div>	
				<div class="row-fluid">
					<div id="footer" class="span12">
						版权所有 2015 hcsoft Corporation. 保留一切权利
					</div>
				</div>
			</div>
		</div>

		<script src="/helloworld/resources/admin/js/jquery.min.js"></script>
		<script src="/helloworld/resources/admin/js/jquery.ui.custom.js"></script>
		<script src="/helloworld/resources/admin/js/bootstrap.min.js"></script>
		<script src="/helloworld/resources/admin/js/jquery.uniform.js"></script>
		<script src="/helloworld/resources/admin/js/select2.min.js"></script>
		<script src="/helloworld/resources/admin/js/jquery.dataTables.min.js"></script>
		<script src="/helloworld/resources/admin/js/unicorn.js"></script>
		<script src="/helloworld/resources/admin/js/unicorn.tables.js"></script>
		<script type="text/javascript" src="/helloworld/resources/js/jquery.pagination.js"></script>
		<script type="text/javascript">
		$(function(){
			var initPagination = function() {
				$("#pagination").pagination(${totalCount}, {
					num_edge_entries: 3, //边缘页数
					num_display_entries: 2, //主体页数
					callback: pageselectCallback,
					items_per_page:${pageSize}, //每页显示创意数量
					current_page:${pageIndex}-1,
					prev_text:"<",
					next_text:">",
					ellipse_text:"...",
					prev_show_always:true,
					next_show_always:true,
					async:false
				});
			 }();
			function pageselectCallback(current_page, panel){
				location.href = "/helloworld/user_list.html?pageIndex="+(current_page+1);
			}
			//
			$(".delBtn").click(function(){
				if(confirm("确定删除吗？")){
					var id=$(this).attr("id");
					$.post("/helloworld/user_del.json",{"id":id},function(data){
						if(data.success="true"){
							location.reload();
						}else{
							alert(data.message);
							return false;
						}
					});
				}
			});
		});
		</script>
		
		
	</body>
</html>